package com.mak.selective.bean;

import java.io.Serializable;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.jdbc.core.JdbcTemplate;

public class DatabaseConfig implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Autowired(required = false)
	private PropertyPlaceholderConfigurer propertyPlaceholderConfigurer; 
	
	@Autowired(required = false)
	private DataSource dataSource;
	
	@Autowired(required=false)
	private JdbcTemplate jdbcTemplate;

	public JdbcTemplate getDataSource(){
		if(dataSource != null){
			jdbcTemplate.setDataSource(dataSource);
		}
		return jdbcTemplate;
	}
}
